package com.xingkeduo.business.user.controller;

import com.xingkeduo.business.transformation.json.CraftsmanJTO;
import com.xingkeduo.business.user.domain.CraftsmanDomain;
import com.xingkeduo.pojo.query.CraftsmanQO;
import com.xingkeduo.util.pojo.base.BaseController;
import com.xingkeduo.util.tool.ReturnUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description:
 * @Author:gaozifeng
 * @Date 2019/5/27 17:54
 **/
@RestController
@RequestMapping("/forgotten")
public class ForGottenController extends BaseController {

    @Autowired
    private CraftsmanDomain craftsmanDomain;

    /**
     * 忘记密码的修改密码
     *
     * @param params:
     * @return : java.lang.String
     * @author : gaozifeng
     * @date : 2019/3/18 21:07
     */
    @PutMapping("/updatePassWord")
    public String updatePassWord(@RequestBody String params) {
        returnUtil = new ReturnUtil();
        try {
            CraftsmanQO craftsmanQO = CraftsmanJTO.createQueryForUpdatePwd(params);
            craftsmanDomain.updatePassWord(craftsmanQO);
            return returnUtil.getSuccess();
        } catch (Throwable t) {
            return dealException(t, returnUtil);
        }
    }

}
